#include<bits/stdc++.h>
using namespace std;
long long n,T;
int bk[200010];
int main() {
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%lld",&n);
	T=n-1;
	for(int i=1; i<=n; i++)scanf("%d",&bk[i]);
	printf("%d",bk[1]);
	printf(" ");
	while(T) {
		for(int i=2; i<=n; i++) {
			if(bk[i]!=bk[i-1]) {
				printf("%d",bk[i]);
				printf(" ");
				bk[i]=bk[i-1];
				T--;
				if(T==0)break;
			}
		}
		if(T==0)break;
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
